/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.components.windows;

import org.biz.app.ui.util.QueryManager;
import org.biz.dao.service.CQuery;
import org.biz.dao.service.Service;

/**
 *
 * @author jawath
 */
public class SearchQueryUIPanel extends javax.swing.JPanel {
  
    protected QueryManager qms;
    protected ListViewUI listView;

    /**
     * Creates new form SearchQueryUIPanel
     */
    public SearchQueryUIPanel() {
//        initComponents();
        init();
    }
    
    public void init(){
            qms=qm;

    }
    
    
    public void setServiceForQuery(Service service){
//    qms=getQueryManager();
    if(qms==null)return;
        qms.setService(service);
    }
    
    
    public QueryManager getQueryManager() {
    return qms;
    }
    
     QueryManager qm=new QueryManager() {

            @Override
            public CQuery getCQuery() {
                if(getService()==null)return null;
                
                return getService().getQueryByCodeLike("");
            }
        
        };
    

     
     public void findAction(){
         //get list view
         // listview get the pageer
         //pager e=> execute the find action
         if(listView==null)return;
         listView.findCommand();
     }
     
    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 607, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 147, Short.MAX_VALUE)
        );
    }// </editor-fold>//GEN-END:initComponents
    // Variables declaration - do not modify//GEN-BEGIN:variables
    // End of variables declaration//GEN-END:variables


    public void setQueryManager(QueryManager qm) {
        this.qm = qm;
    }
    
    
    public void setListView(ListViewUI listView){
        this.listView = listView; 
    }
    
}
